#ifndef __triac_h
#define __triac_h

//Hal------------------
#define F_triacOn()   P2_0 = 0
#define F_triacOff()  P2_0 = 1
#define D_crossZero   P1_5 
//Const-----------------
#define D_triacHoldTime   4 //base 0.125ms 
#define D_watt 20

#define D_15	31
#define D_30	27
#define D_40	25
#define D_45	24
#define D_60	20
#define D_80   	15
#define D_85  	13
#define D_100 	0
// //Var-----------------
	#ifdef __triac_c
		uint8_t TriacLastTimer;
		bit bLastZero ;
		bit bZero ;
		bit bDelay ;
		bit bWattSetted ;
		bit	bAlarm ;	
		uint16_t fireType ;
		uint8_t triacTimer ,delayTimer ;
		uint8_t zeroCounter ;
	#else
		extern 	uint8_t TriacLastTimer;

		extern bit bLastZero ;
		extern bit bZero ;
		extern bit bDelay ;
		extern bit bWattSetted ;
		extern bit	bAlarm ;
		extern uint16_t fireType ;
		extern uint8_t triacTimer ,delayTimer ;	
		extern uint8_t zeroCounter ;
	#endif
//Function-------------------
void InitTriac() ;


#endif
